//
//  HNavigationController.m
//  HTanzhi
//
//  Created by 陈贵 on 15/10/28.
//  Copyright © 2015年 hzj. All rights reserved.
//

#import "HNavigationController.h"
#import "HHomeViewController.h"

@interface HNavigationController ()

@end

@implementation HNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
}

+ (void)initialize
{
    UINavigationBar *navBar = [UINavigationBar appearance];
    //背景
    [navBar setBackgroundImage:[UIImage imageNamed:@"bcImage"] forBarMetrics:UIBarMetricsDefault];
    //文字颜色
    [navBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    //是否透明
    navBar.translucent = NO;
    
    //统一设置导航按钮的样式
    UIBarButtonItem *item = [UIBarButtonItem appearance];
    //设置字体颜色和大小
    [item setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15],NSForegroundColorAttributeName:[UIColor whiteColor]} forState:UIControlStateNormal];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    
    UIBarButtonItem *bacItem = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:@"btnBack"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    
    viewController.navigationItem.leftBarButtonItem = bacItem;
    
    [super pushViewController:viewController animated:YES];
}

- (void) back{
    
    [self popViewControllerAnimated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
